import { useUserStore } from '@/stores'

/**
 * 获取登录消息
 */
export const getLoginMsg = () => {
    const store = useUserStore()
    return store.userInfo
}
/**
 * 获取平台信息
 */
export const getSysInfo = () => {
    const adminCode = import.meta.env.LH_ADMINCODE
    let sysInfo = {
        AdminCode: '',
        AdminName: '',
        SystemName: '',
    }
    switch (adminCode) {
        case '430524':
            sysInfo.AdminCode = '430524'
            sysInfo.AdminName = '隆回县'
            sysInfo.SystemName = '隆回县地质灾害风险双控移动平台'
            break
        case '431122':
            sysInfo.AdminCode = '431122'
            sysInfo.AdminName = '东安县'
            sysInfo.SystemName = '东安县地质灾害风险双控服务智慧平台'
            break
        case '431027':
            sysInfo.AdminCode = '431027'
            sysInfo.AdminName = '桂东县'
            sysInfo.SystemName = '桂东县地质灾害风险双控服务智慧平台'
            break
        case '431382':
            sysInfo.AdminCode = '431382'
            sysInfo.AdminName = '涟源市'
            sysInfo.SystemName = '涟源市地质灾害风险双控移动平台'
            break
        default:
            break
    }
    return sysInfo
}
export const getYhdTypeName = (type) => {
    let typename = '未定义'
    switch (type) {
        case '00':
            typename = '不稳定斜坡'
            break
        case '01':
            typename = '滑坡'
            break
        case '02':
            typename = '崩塌'
            break
        case '03':
            typename = '泥石流'
            break
        case '04':
            typename = '地面塌陷'
            break
        case '06':
            typename = '地裂缝'
            break
        case '07':
            typename = '地面沉降'
            break
        case '16':
            typename = '斜坡孕灾条件'
            break
        case '17':
            typename = '沟谷孕灾条件'
            break
        case '18':
            typename = '风险区'
            break
        default:
            break
    }
    return typename
}

export const callPhone = (phone) => {
    if (!phone) return
    uni.makePhoneCall({
        phoneNumber: phone + '',
    })
}
